package com.bdqn.ch03.proxy;

import net.sf.cglib.proxy.Enhancer;

public class IntermdiaryCglibProxyFactory {
    private static IntermediaryMethodInterceptor interceptor = new IntermediaryMethodInterceptor();

    public static <T> T create(Class<T> target){
        Enhancer enhancer =new Enhancer();
        enhancer.setCallback(interceptor);
        enhancer.setSuperclass(target);
        return (T) enhancer.create();
    }
}
